home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / os2 / epmgcc30.zip / BCCPARSE.E < prev    next >
Text File  |  1996-07-06  |  3KB  |  76 lines

  1. /*
  2. ╔══════════════════════════════════════════════════════════════════════════════╗
  3. ║ What's it called: EPMGCC  V3.00                                              ║
  4. ║                                                                              ║
  5. ║ What does it do:  The E source code for the GCC-Interface for EPM.           ║
  6. ║                   This file contains the code for the error parser of        ║
  7. ║                   compile time errors issued by bcc (infomational messages   ║
  8. ║                   and linker errors are skipped).                            ║
  9. ║                   This module is linked seperately to allow the user to      ║
  10. ║                   change the error-parser during runtime. See the            ║
  11. ║                   documentation for details.                                 ║
  12. ║                                                                              ║
  13. ║ Who and When:     B. Bablok 12/93 - 07/96                                    ║
  14. ║                                                                              ║
  15. ╚══════════════════════════════════════════════════════════════════════════════╝
  16. */
  17. DEFC gcc_parse_error =
  18.    UNIVERSAL gcc_error_file_id, gcc_other_file_id, gcc_error_file,
  19.              gcc_line2index, gcc_index2err, gcc_error_index
  20.  
  21.    parse_all = ARG(1) <> ''
  22.    error_no = 0
  23.    col      = 1                        -- gcc gives no info on column of error
  24.  
  25.    WHILE (.line <= .last) DO           -- iterate until a "true" error is found
  26.      GETLINE  line
  27.  
  28.      IF WORD(line,1) = 'Error' OR WORD(line,1) = 'Warning' THEN
  29.        IF POS(":",WORD(line,2)) > 0 THEN
  30.         PARSE VALUE SUBWORD(line,2) WITH drive ":" filename lineno ":" gcc_message
  31.           filename = drive":"filename
  32.        ELSE
  33.           PARSE VALUE SUBWORD(line,2) WITH filename lineno ":" gcc_message
  34.        ENDIF
  35.      ELSE
  36.         lineno = 'junk'
  37.      ENDIF
  38.  
  39.      IF NOT ISNUM(lineno) THEN
  40.        IF .line = .last THEN
  41.           IF NOT parse_all THEN
  42.              ACTIVATEFILE gcc_other_file_id
  43.              SAYERROR "No more errors!"
  44.           ELSE
  45.              DO_ARRAY 2, gcc_line2index, 0, error_no
  46.              DO_ARRAY 2, gcc_index2err, 0, error_no
  47.           ENDIF
  48.           RETURN
  49.        ELSE                           -- try the next line
  50.          "+1"
  51.        ENDIF
  52.  
  53.      ELSEIF NOT parse_all THEN                              -- found an error
  54.        "EDIT" TRANSLATE(filename,'\','/') "'"lineno"'"
  55.        SAYERROR gcc_message
  56.        RETURN
  57.  
  58.      ELSE
  59.        error_no = error_no + 1
  60.        DO_ARRAY 2, gcc_line2index, .line, error_no
  61.        DO_ARRAY 2, gcc_index2err, 'line.'error_no, lineno
  62.        DO_ARRAY 2, gcc_index2err, 'col.'error_no, col
  63.        DO_ARRAY 2, gcc_index2err, 'file.'error_no, filename
  64.        DO_ARRAY 2, gcc_index2err, 'msg.'error_no, gcc_message
  65.        line = .line
  66.        DO_ARRAY 2, gcc_index2err, 'orig.'error_no, line
  67.        IF .line = .last THEN
  68.           DO_ARRAY 2, gcc_line2index, 0, error_no
  69.           DO_ARRAY 2, gcc_index2err, 0, error_no
  70.           RETURN
  71.        ELSE
  72.          "+1"
  73.        ENDIF
  74.      ENDIF
  75.    ENDWHILE
  76.